package cn.iocoder.yudao.module.system.controller.admin.mini.group.order.controller.admin.grouporder;

import cn.iocoder.yudao.module.system.controller.admin.mini.group.order.controller.admin.grouporder.vo.GroupOrderPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.mini.group.order.controller.admin.grouporder.vo.GroupOrderRespVO;
import cn.iocoder.yudao.module.system.controller.admin.mini.group.order.dal.dataobject.grouporder.GroupOrderDO;
import cn.iocoder.yudao.module.system.controller.admin.mini.group.order.service.grouporder.GroupOrderService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;

import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;

import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;


@Tag(name = "管理后台 - 团购订单")
@RestController
@RequestMapping("/qd/group-order")
@Validated
public class GroupOrderController {

    @Resource
    private GroupOrderService groupOrderService;


    @GetMapping("/get")
    @Operation(summary = "获得团购订单")
    @Parameter(name = "id", description = "编号", required = true, example = "1024")
    @PreAuthorize("@ss.hasPermission('qd:group-order:query')")
    public CommonResult getGroupOrder(@RequestParam("id") Integer id) {
        return success(groupOrderService.getGroupOrder(id));
    }

//    @GetMapping("/list")
//    @Operation(summary = "获得团购订单列表")
//    @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
//    @PreAuthorize("@ss.hasPermission('qd:group-order:query')")
//    public CommonResult<List<GroupOrderRespVO>> getGroupOrderList(@RequestParam("ids") Collection<Integer> ids) {
//        List<GroupOrderDO> list = groupOrderService.getGroupOrderList(ids);
//        return success(GroupOrderConvert.INSTANCE.convertList(list));
//    }

    @GetMapping("/page")
    @Operation(summary = "获得团购订单分页")
    @PreAuthorize("@ss.hasPermission('qd:group-order:query')")
    public CommonResult getGroupOrderPage(@Valid GroupOrderPageReqVO pageVO) {
        return success(groupOrderService.getGroupOrderPage(pageVO));
    }


}
